#pragma once
#include "CityList.h"
#include "DataType.h"
#include "TaobaoCrawler.h"
#include "TaobaoParser.h"
#include "interface.h"

class Builder
{
public:
	Builder(){};
public:
	virtual    ~Builder(void){};

public:
	virtual void makeCraw(City fromCity, City toCity, string date ) = 0;
	virtual void getContent() =0;
	virtual void makeParse(string fn) = 0;
public:
	ResultContainer m_rc;
	string    content;
	string    m_url;
};

class TaobaoBuilder
	: public Builder
{
public:
	TaobaoBuilder()	{}
	 virtual ~TaobaoBuilder(){}

public:
	void makeCraw(City fromCity, City toCity, string date);
	void getContent();
	void makeParse(string fn);
public:
	TaobaoCrawler tc;
	TaobaoParser tp;


};


class Director
{
public:
	Director(Builder* b)
	{
		this->builder = b;
	}
	~Director()
	{
		delete(this->builder);
		builder = NULL;
	}
public:
	void construct(City fromCity, City toCity, string date ,string fileName) 
	{
		builder->makeCraw(fromCity,  toCity, date);
		builder->getContent();
		builder->makeParse(fileName);
	}

private:
	Builder* builder;

};